//
//  RNOLMyRedBagCardCell.m
//  RongNiuOnline
//
//  Created by apple on 2018/4/25.
//  Copyright © 2018年 rongniu. All rights reserved.
//

#import "RNOLMyRedBagCardCell.h"

@interface RNOLMyRedBagCardCell ()

@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;

@property (weak, nonatomic) IBOutlet UILabel *moneyValueLabel;

@property (weak, nonatomic) IBOutlet UILabel *redBagNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *originLabel;

@property (weak, nonatomic) IBOutlet UIImageView *waterMarkImageView;

@property (weak, nonatomic) IBOutlet UILabel *dueTimeLabel;

@property (weak, nonatomic) IBOutlet UIButton *immediatelyButton;

@end


@implementation RNOLMyRedBagCardCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self.waterMarkImageView setAllCorner: self.waterMarkImageView.width/2.0];
    [self.contentView sendSubviewToBack: self.bgImageView];
    [self.bgImageView setLayerShadow:KBlackColor offset:CGSizeMake(1, 1) radius:5];


}
- (void)setType:(RNOLGiftCertificationType)type{
    _type = type;
    if (type == RNOLGiftCertificationTypeAvaiable) {
        [self avaiableLayout];
    }else{
        [self expireOrUsedLayout];
    }
}

#pragma mark - 可用
- (void)avaiableLayout{
    self.bgImageView.image = [UIImage imageNamed:@"rnol_redbag_bg_avable"];
    self.immediatelyButton.hidden = NO;
    self.waterMarkImageView.hidden = YES;
    self.moneyValueLabel.textColor = kRedBagColor;
    self.redBagNameLabel.textColor = kTextColor;
}

#pragma mark -  过期或者已使用
- (void)expireOrUsedLayout{
    self.bgImageView.image = [UIImage imageNamed:@"rnol_redbag_bg_disable"] ;
    self.immediatelyButton.hidden = YES;
    self.waterMarkImageView.hidden = NO;
    NSString *imageName = self.type == RNOLGiftCertificationTypeAlreadyUsed? @"rnol_redbag_watermark_used" : @"rnol_redbag_watermark_due";
    self.waterMarkImageView.image = [UIImage imageNamed: imageName];
    self.moneyValueLabel.textColor = kTextLightGrayColor;
    self.redBagNameLabel.textColor = kTextLightGrayColor;
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
